package com.thinkgem.jeesite.modules.sys.utils;

import java.sql.Connection;
import java.sql.DriverManager;
import java.sql.ResultSet;
import java.sql.Statement;
import java.util.Properties;

import com.thinkgem.jeesite.common.config.Global;

public class JdbcUtil {

  public static Connection getConnection() {
    Connection con = null;
    try {
      Class.forName(Global.getConfig("driver"));
      con = DriverManager.getConnection(Global.getConfig("url"), Global.getConfig("uname"), Global.getConfig("upass"));     
      System.out.println("连接成功");
      return con;
    } catch (Exception e) {
      e.printStackTrace();
      return null;
    }
  }
  public static void close(ResultSet rs,Statement stmt,Connection con){
    try{if(rs!=null)rs.close();}catch(Exception e){}
    try{if(stmt!=null)stmt.close();}catch(Exception e){}
    try{if(con!=null)con.close();}catch(Exception e){}
  }
  
  
}